// mine/pages/passwordedit/index.js
const $api = require("../../../api/mine").API

Page({

  /**
   * 页面的初始数据
   */
  data: {
    member_pass:"",
    s_member_pass:"",
  },
  // 修改用户密码
  modifyMemberPass(e){
    var t = this
    if( !t.data.member_pass || !t.data.s_member_pass ){
      wx.showToast({
        title: '密码不能为空',
      })
      return false
    }
    if( t.data.member_pass !== t.data.s_member_pass ){
      wx.showToast({
        title: '两次密码不一致',
      })
      return false
    }
    var data = {
      member_mobile:wx.getStorageSync('user').member_mobile,
      member_pass:t.data.member_pass,        
      member_type:2,      //1=老师;2=家长;3=机构;4=游客;
    }
    $api.modifyMemberPass(data).then(res=>{
      console.log(res)
    })
  },
  // 新密码
  set_member_pass(e){
    var t = this
    t.setData({
      member_pass:e.detail
    })
  },
  // 确认密码
  set_s_member_pass(e){
    var t = this
    t.setData({
      s_member_pass:e.detail

    })
  }
})